import React from 'react'
import { Route, IndexRoute } from 'react-router'

import {
    App,
    Home,  //主页
    AuthError, //授权失败页
    Paysuccess, //支付成功页
    Payment, //订单确认页
    HandlingProgress, //进度详情
    AddAddress, //添加地址
    AddressEdit, //编辑地址
    AddressList,  //地址列表
    OrderList, //我的订单
    OrderDetails, //订单详情页
    AddInfo, //补充资料页
    UploadPage, //上传图片页面
    ImgsCarousel,
    NotFoundPage,
} from './containers'

export default (
  <Route path="/" component={App}>
    <IndexRoute component={Home}/>
    <Route path="authError" components={AuthError}/>
    <Route path="paysuccess" components={Paysuccess}/>
    <Route path="payment" components={Payment}/>
    <Route path="handlingProgress/:orderId/:chargeId" components={HandlingProgress}/>
    <Route path="addAddress" components={AddAddress}/>
    <Route path="addressEdit/:addressId" components={AddressEdit}/>
    <Route path="addressList" components={AddressList}/>
    <Route path="orderList(/:type)" components={OrderList}/>
    <Route path="orderDetails/:orderId/:chargeId(/:type)" components={OrderDetails}/>
    <Route path="addInfo" components={AddInfo}/>
    <Route path="uploadPage/:type" components={UploadPage}/>
    <Route path="ImgsCarousel" component={ImgsCarousel} />

    {/*<Route path="路由地址" getComponents={(nextState, cb) => {
        require.ensure([], (require) => {
          cb(null, require('./组件路径/按需加载demo').default)
        }, 'chunkName')
      }} />*/}
    <Route path="*" component={NotFoundPage}/>
  </Route>
);